package day10;
import java.io.*;
/**
 * @author oldliu
 * @since 1.0
 */
public class Jiami {
    public static void main(String[] args)throws Exception {
        String oldFileName="D:\\Documents\\桌面\\baijiaxing.txt";
        File a3=new File(oldFileName);
        FileInputStream a=new FileInputStream(oldFileName);
        byte b[]=new byte[a.available()];
        a.read(b);
        a.close();
        for(int i=0;i<b.length;i++){
            b[i]=(byte) (~b[i]);
        }
        //临时文件
        File newFile=new File("D:\\Documents\\桌面\\"+Math.random()+".png");
        FileOutputStream a1=new FileOutputStream(newFile);
        a1.write(b);
        a1.close();

        a3.delete();//删除
        //把新文件改成和老文件一样的名字
        newFile.renameTo(a3);
    }
}
